package com.mall.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mall.auth.dao.MallCustomerMapper;
import com.mall.auth.service.AuthService;
import com.mall.common.dto.auth.SysUserDTO;
import com.mall.common.response.ResponseResultEnum;
import com.mall.common.response.ServerResponse;
import com.mall.common.vo.auth.CustomerLoginReqVo;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Service
public class AuthServiceImpl implements AuthService {

    Logger logger = LoggerFactory.getLogger(AuthServiceImpl.class);

    @Resource
    private  MallCustomerMapper mallCustomerMapper;
    @Override
    public ServerResponse login(CustomerLoginReqVo reqVo) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("account",reqVo.getAccount());
        SysUserDTO userInfo = mallCustomerMapper.selectOne(wrapper);
        if (null == userInfo){
            logger.info("login","客户信息不存在",reqVo.getAccount());
            return ServerResponse.buildError(ResponseResultEnum.LOGIN_ERROR);
        }



        return null;
    }
}
